#include <QtPlugin>

#include <QVBoxLayout>
#include <QSpinBox>
#include <QWidget>
#include <QPushButton>
#include <QFileDialog>
#include <QLineEdit>
#include <QInputDialog>
#include <QCheckBox>

#include <QRadioButton>

#include <opencv/cv.h>
#include <opencv/highgui.h>

#include <queue>

#include "QCVModuleInterface.h"
#include "QCVModuleHandlerInterface.h"

#include "CLUT.h"
#include "QCVGraph.h"

#ifndef MODULE_CLUT_MANAGER
#define MODULE_CLUT_MANAGER

class ModuleManagerCLUT:public QObject,QCVModuleInterface
{
  Q_OBJECT
	Q_INTERFACES(QCVModuleInterface)
	
	public:
		void init(QCVModuleHandlerInterface * parent);
		void free();

		cv::Mat & process();
		void setInput(int n,const cv::Mat & m);

		QWidget* widget();
		QString getName();
		int nbInputs();
		QString help(int id);
		bool setParams(QString params);
    QString getParams();

		QCVModuleInterface * clone();
		

	public slots:
		void s_direct_open_clut(QString filename);
		void s_open_fuzzy_clut();
		void s_save_fuzzy_clut();
		void s_open_clut();
		void s_save_clut();
		void s_create_distance_clut();
		void s_create_entropy_clut_from_fuzzy();

	private:  
		
		QRadioButton * C16_mode,* C11_mode;
		QCheckBox * color_mode;

		QLineEdit * le_filename;		
		
		QPushButton * pb_open_fuzzy_clut;		
		QPushButton * pb_save_fuzzy_clut;
		QPushButton * pb_open_clut;		
		QPushButton * pb_save_clut;
		QPushButton * pb_create_distance_clut;
		QPushButton * pb_create_entropy_clut_from_fuzzy;

    QWidget * win;
    QVBoxLayout * layout;

		cv::Mat currentFrame;
		cv::Mat result;

		cv::Mat fuzzyclut;
		cv::Mat clut11c;
		cv::Mat clut16c;
		cv::Mat entropyclut;

		QCVModuleHandlerInterface * parent;
};

#endif
